Skip to content
This repository was archived by the owner on Dec 10, 2018. It is now read-only.

Conversation

@pawl
Copy link

@pawl pawl commented Mar 21, 2017

The pure python binary protocol will throw errors like this when it's unable to decode a value:

AttributeError: 'int' object has no attribute 'encode'

The cython version of the binary protocol throws more helpful errors like this:

ERROR:thriftpy.server:Field 'success(0)' of 'ping_result' needs type 'STRING', but the value is `123`

This changes the pure python version to behave more like the cython version.

This PR also refactors write_val in thriftpy/protocol/binary.py to look similar to c_write_val in thriftpy/protocol/cybin/cybin.c.


from io import BytesIO

import pytest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not import a third-party package IMHO

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants